From a3336a507519c1d28db3bbff8e439aa3811733f3 Mon Sep 17 00:00:00 2001 From: Boris Ostrovsky Date: Fri, 22 Jul 2016 13:14:01 -0400 Subject: [PATCH] tools/libxc: Properly increment ApicIdCoreSize field on AMD Current code incorrectly adds 1 to full register instead of incrementing the field in bits 15:12. Signed-off-by: Boris Ostrovsky Acked-by: Wei Liu --- tools/libxc/xc_cpuid_x86.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c index 84f4e0810b..fbbac9e25a 100644 --- a/tools/libxc/xc_cpuid_x86.c +++ b/tools/libxc/xc_cpuid_x86.c @@ -331,7 +331,8 @@ static void amd_xc_cpuid_policy(xc_interface *xch, * ECX[15:12] is ApicIdCoreSize: ECX[7:0] is NumberOfCores (minus one). * Update to reflect vLAPIC_ID = vCPU_ID * 2. */ - regs[2] = ((regs[2] & 0xf000u) + 1) | ((regs[2] & 0xffu) << 1) | 1u; + regs[2] = ((regs[2] + (1u << 12)) & 0xf000u) | + ((regs[2] & 0xffu) << 1) | 1u; break; case 0x8000000a: { -- 2.30.2